<?php 

$slides_result = $wpdb->get_results("SELECT * FROM rd_slides where is_enable = true");

?>		
    <link rel="stylesheet" href="<?php bloginfo('template_directory');?>/include/slider/themes/1205/theme.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_directory');?>/include/slider/css/nivo-slider.css" type="text/css" media="screen" />

    <div id="wrapper">
        <div class="slider-wrapper theme-theme1205">
            <div class="ribbon"></div>
            <div id="slider" class="nivoSlider">
            <?php 
            
            for($i = 1;$i<=count($slides_result);$i++)
            {
            ?>
            	<img src="<?php bloginfo('template_directory');?><?php echo slides_dir.$slides_result[$i-1]->photo_id?>" alt="" title="#sliderCaption<?php echo $i?>" />
            <?php 
            } 
            ?>           
			</div>
        </div>
        	<?php 
            
            for($i = 1;$i<=count($slides_result);$i++)
            {
            ?>
            	<div id="sliderCaption<?php echo $i?>" class="nivo-html-caption">
					<?php echo get_value_by_locale($slides_result[$i-1],'name') ?>  
            	</div>
            <?php 
            } 
            ?> 
    </div>
    <script type="text/javascript" src="<?php bloginfo('template_directory');?>/include/slider/js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory');?>/include/slider/js/jquery.nivo.slider.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider({
            effect:'fade',
            animSpeed: 500, 
            pauseTime: 4000
        });
    });
    </script>